{include file="index/header"}
<body>
<div class="fly-panel fly-panel-user">
    <div class="tpt-admin">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>添加采集器</legend>
        </fieldset>
        <form class="layui-form">
            <!-- 采集器名称 -->
            <div class="layui-form-item">
                <label class="layui-form-label">采集器名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" required lay-verify="required" placeholder="必填内容" autocomplete="off" class="layui-input">
                </div>
            </div>
            <!-- 关键词 -->
            <div class="layui-form-item">
                <label class="layui-form-label">关键词</label>
                <div class="layui-input-block">
                    <input type="text" name="keyword" required lay-verify="required" placeholder="必填内容" autocomplete="off" class="layui-input">
                </div>
            </div>
            <!-- 采集分类ID -->
            <div class="layui-form-item">
                <label class="layui-form-label">采集分类ID</label>
                <div class="layui-input-block">
                    <input type="text" name="catIds" autocomplete="off" class="layui-input" placeholder="后台类目ID，用,分割，最大10个，该ID可以通过taobao.itemcats.get接口获取到">
                </div>
            </div>
            <!-- 入库分类 -->
            <div class="layui-form-item" style="width: 300px;">
                <label class="layui-form-label">入库分类</label>
                <div class="layui-input-block">
                    <select name="cid">
                        {volist name="CategoryList" id="vo"}
                        {if condition="$vo.open eq 1"}
                        <option value="{$vo.id}">{$vo.name}</option>
                        {/if}
                        {/volist}
                    </select>
                </div>
            </div>
            <!-- 排序方式 -->
            <div class="layui-form-item" style="width: 300px;">
                <label class="layui-form-label">排序方式</label>
                <div class="layui-input-block">
                    <select name="sort">
                        <option value=" ">综合排序</option>
                        <option value="tk_rate_des">降序</option>
                        <option value="tk_rate_asc">升序</option>
                        <option value="total_sales">销量</option>
                        <option value="price">价格</option>
                        <option value="tk_total_sales">累计推广量</option>
                        <option value="tk_total_commi">总支出佣金</option>
                        <option value="tk_rate">淘客佣金比率</option>
                    </select>
                </div>
            </div>
            <!-- 图片牛皮廯 -->
            <div class="layui-form-item" style="width: 300px;">
                <label class="layui-form-label">图片牛皮廯</label>
                <div class="layui-input-block">
                    <select name="npx_level">
                        <option value="1">不限</option>
                        <option value="2">无</option>
                        <option value="3">轻微</option>
                    </select>
                </div>
            </div>
            <!-- 淘客佣金比率 -->
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">淘客佣金比率</label>
                    <div class="layui-input-inline" style="width: 150px;">
                        <input type="text" name="start_tk_rate" value="5" autocomplete="off" placeholder="1234表示12.34%" class="layui-input">
                    </div>
                    <div class="layui-form-mid"> - </div>
                    <div class="layui-input-inline" style="width: 150px;">
                        <input type="text" name="end_tk_rate" value="90" autocomplete="off" placeholder="1234表示12.34%" class="layui-input">
                    </div>
                </div>
                <span>淘客佣金比率，如：1234表示12.34%</span>
            </div>
            <!-- 折扣 -->
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">折扣价范围</label>
                    <div class="layui-input-inline" style="width: 150px;">
                        <input type="text" name="start_price" value="" placeholder="￥" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid"> - </div>
                    <div class="layui-input-inline" style="width: 150px;">
                        <input type="text" name="end_price" value="" placeholder="￥" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <span>单位：元</span>
            </div>
            <!-- 包邮 -->
            <div class="layui-form-item">
                <label class="layui-form-label">包邮</label>
                <div class="layui-input-block">
                    <input type="radio" name="need_free_shipment" value="false" title="不限" checked="">
                    <input type="radio" name="need_free_shipment" value="true" title="包邮">
                </div>
            </div>
            <!-- 优惠卷 -->
            <div class="layui-form-item">
                <label class="layui-form-label">优惠卷</label>
                <div class="layui-input-block">
                    <input type="radio" name="has_coupon" value="false" title="不限" >
                    <input type="radio" name="has_coupon" value="true" title="优惠卷" checked="">
                </div>
            </div>
            <!-- 淘宝商品 -->
            <div class="layui-form-item">
                <label class="layui-form-label">淘宝商品</label>
                <div class="layui-input-block">
                    <input type="radio" name="is_tmall" value="false" title="不限" checked="">
                    <input type="radio" name="is_tmall" value="true" title="淘宝商品" >
                </div>
            </div>
            <!-- 采集页数 -->
            <div class="layui-form-item">
                <label class="layui-form-label">页数</label>
                <div class="layui-input-block">
                    <input type="text" name="page_no" required lay-verify="required" placeholder="必填内容、默认1" value="1" autocomplete="off" class="layui-input">
                </div>
            </div>
            <!-- 采集页数大小 -->
            <div class="layui-form-item">
                <label class="layui-form-label">页数大小</label>
                <div class="layui-input-block">
                    <input type="text" name="page_size" required lay-verify="required" placeholder="必填内容、页大小，默认20，1~100" value="20" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="ShoppingGuideCollectAdd">立即提交</button>
                    <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">返回</button>
                </div>
            </div>
        </form>
    </div>
</div>
{include file="index_footer"}
<script type="text/javascript">
    layui.use(['form'],function(){
        var form = layui.form()
            ,jq = layui.jquery;

        form.on('submit(ShoppingGuideCollectAdd)', function(data){
            loading = layer.load(2, {
                shade: [0.2,'#000']
            });
            var param = data.field;
            $.ajax({
                type: 'POST',
                url: '{:url("ShoppingGuideCollect/add")}',
                data: param,
                dataType:'json',
                success: function(data){
                    if(data.code == 200){
                        layer.close(loading);
                        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
                            location.href = '{:url("ShoppingGuideCollect/index")}';
                        });
                    }else{
                        layer.close(loading);
                        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
                    }
                },
            });
            return false;
        });
    })
</script>
</body>
</html>